Ext.ux.ViewCorpration = Ext.extend(Ext.Window, {
	idString:'',
	initComponent : function(config) {
		var linedata = Ext.getCmp(this.idString).getStore()
				.getAt(Ext.getCmp(this.idString).getSelectionModel().lastActive);
		
		var modifyForm = new Ext.FormPanel({
        	labelWidth : 100, // label settings here cascade unless overridden
			autoScroll:true,
			frame : true,
			region : 'center',
			border:true,
			fileUpload: true,
			bodyStyle : 'padding:5px 5px 0',
			width : '100%',
			defaults : {
				width : 220
			},
			defaultType : 'textfield',

			items : [{
				fieldLabel : '语言',
				id:'corprationLangView',
				editable:false,
				allowBlank : false
			},{
				fieldLabel : '企业地址',
				id:'corprationAddressView',
				allowBlank : false
			},{
				fieldLabel : '企业邮箱',
				id:'corprationEmailView',
				allowBlank : false
			},{
				fieldLabel : '企业传真',
				id:'corprationFaxView',
				allowBlank : false
			},{
				fieldLabel : '联系电话',
				id:'corprationTelephoneView',
				allowBlank : false
			},{
				fieldLabel : '所在地邮编',
				id:'corprationZipcodeView',
				allowBlank : false
			},{
				xtype:'StarHtmleditor',
				fieldLabel : '企业简介',
				anchor:'95%',
				height:300,
				allowBlank : false,
				autoScroll:true,
				url:basePath + 'base/upload.action',
				id:'corprationAboutUsView'
			},{
				xtype:'StarHtmleditor',
				fieldLabel : '企业文化',
				anchor:'95%',
				height:300,
				allowBlank : false,
				autoScroll:true,
				url:basePath + 'base/upload.action',
				id:'corprationCultureView'
			},{
				xtype:'StarHtmleditor',
				fieldLabel : '企业前景',
				anchor:'95%',
				height:300,
				allowBlank : false,
				autoScroll:true,
				url:basePath + 'base/upload.action',
				id:'corprationProspectsView'
			}]
		});
		
		var jsonObject;
		Ext.Ajax.request( {
			url : basePath + 'corpration/load.action?corpration.id=' + linedata.json.id,
			method : 'post',
			callback : function(op, success, response) {
				var jsonObject = eval('(' + response.responseText + ')');
				Ext.getCmp("corprationAddressView").setValue(jsonObject.address);
    			Ext.getCmp("corprationEmailView").setValue(jsonObject.email);
    			Ext.getCmp("corprationFaxView").setValue(jsonObject.fax);
    			Ext.getCmp("corprationTelephoneView").setValue(jsonObject.telephone);
				Ext.getCmp("corprationZipcodeView").setValue(jsonObject.zipcode);
    			Ext.getCmp("corprationAboutUsView").setValue(jsonObject.aboutUs);
    			Ext.getCmp("corprationCultureView").setValue(jsonObject.culture);
    			Ext.getCmp("corprationProspectsView").setValue(jsonObject.prospects);
    			var langName;
    			switch(jsonObject.lang) {
    				case 'zh_CN' : langName = '简体中文'; break;
    				case 'zh_TW' : langName = '繁体中文'; break;
    				case 'en_US' : langName = '美式英文'; break;
    			}
    			Ext.getCmp("corprationLangView").setValue(langName);
			}
		});
		
		Ext.apply(this, {
			title: "查看企业信息",
	        plain: true,
	        width:1000,
	        height:600,
	        modal: true,
	        maximizable:true,
	        border: false,
	        layout: 'border',
	        autoScroll:true,
	        items: [modifyForm]
		});
		Ext.ux.ViewCorpration.superclass.initComponent.apply(this, arguments);
	}
});
Ext.reg('lgnViewCorpration', Ext.ux.ViewCorpration);
